<?php if(!defined('HOST'))die('not access');?>
<script >
    var c;
    $(document).ready(function(){
        {params};
        var a = $('#veiw_{rand}').bootstable({
            tablename:'zbcg_signature_log',celleditor:true,sort:'id',dir:'desc',params:{},checked:true,fanye:true,
            url:js.getajaxurl('slogs','log','{dir}',{'utype':0}),fanye:true,
            columns:[{
                text:'文档名',dataIndex:'doc_name'
            },{
                text:'签章类型',dataIndex:'seal_name'
            },{
                text:'签章人',dataIndex:'name'
            }, {
                text:'ip',dataIndex:'ip'
            },{
                text:'时间',dataIndex:'create_time'
            }],
            rendertr:function(d){
                var s = '';
                var type = d.seal_name;
                type = type.substr(0,4);
                console.log(type);
                if(type == 'sign') {
                    d.seal_name = '公章';
                    s='style="color:bule"';
                } else if(type == 'qmim') {
                    d.seal_name = '手写签名';
                    s='style="color:green"';
                } else {
                    d.seal_name = '个人签名';
                    s='style="color:black"';
                }
                return s;
            }
        });

        c = {
            reload:function(){
                a.reload();
            },
            search:function(){
                var uname =$('#uname_{rand}').val();
                var pdfname =$('#pdfname_{rand}').val();
                var sdate =$('#search_sdate_{rand}').val();
                var edate =$('#search_edate_{rand}').val();
                a.setparams({uname:uname, pdfname:pdfname, sdate:sdate, edate:edate},true);
            },
        };
        js.initbtn(c);
    });
</script>


<div>
    <table width="100%">
        <tr>
            <td nowrap>
                <input class="form-control" style="width:300px" id="pdfname_{rand}" placeholder="文档名称">
            </td>
            <td>
                <input class="form-control" style="width:300px" id="uname_{rand}" placeholder="签章人">
            </td>
            <td>
                时间：
                <input onclick="js.datechange(this,'date')" value="" class="inputs datesss" inputtype="date" readonly="" name="search_sdate" id="search_sdate_{rand}" style="width:110px">
                <input onclick="js.datechange(this,'date')" value="" class="inputs datesss" inputtype="date" readonly="" name="search_edate" id="search_edate_{rand}" style="width:110px">
            </td>
            <td>
                <button class="btn" id="t_year" type="button">年</button>
                <button class="btn" id="t_season" type="button">季</button>
                <button class="btn" id="t_month" type="button">月</button>
            </td>
            <td nowrap style="padding-left:5px">
                <button class="btn btn-default" click="search" type="button">搜索</button>
                <i id="msgview"></i>
            </td>
        </tr>
        <tr>
        </tr>
    </table>
</div>
<div class="blank10"></div>
<div id="veiw_{rand}"></div>
<script>
    $(document).ready(function(){
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth();
        var month = month + 1;
        var day = date.getDate();
        $("#t_year").click(function(){
            var sdate=$('#search_sdate_{rand}').val(year+'-01-01');
            var edate=$('#search_edate_{rand}').val(year+'-12-31');
        });
        $("#t_season").click(function(){
            stime = '';
            etime = '';
            switch(true) {
                case (month <= 3):
                    stime = year+'-01-01';
                    etime = year+'-03-31';
                    break;
                case (3 < month <= 6):
                    stime = year+'-04-01';
                    etime = year+'-06-30';
                    break;
                case (6 < month <= 9):
                    stime = year+'-07-01';
                    etime = year+'-09-30';
                    break;
                case (9 < month <= 12):
                    stime = year+'-10-01';
                    etime = year+'-12-31';
                    break;
            }
            var sdate=$('#search_sdate_{rand}').val(stime);
            var edate=$('#search_edate_{rand}').val(etime);
        });
        $("#t_month").click(function(){
            var lastDay= new Date(year,month,0).getDate();
            var sdate=$('#search_sdate_{rand}').val(year+'-'+month+'-01');
            var edate=$('#search_edate_{rand}').val(year+'-'+month+'-'+lastDay);
        });

    });
</script>